@echo off

SET msbuild=C:\Windows\Microsoft.NET\Framework\v3.5\msbuild.exe
SET zip="%ProgramFiles%\7-Zip\7z.exe"
SET solution=ZenWplExporter.sln
SET dropDir=Build

echo Building Debug Configuration ...
%msbuild% %solution% /t:Rebuild /p:Configuration=Debug /fileLogger /fileLoggerParameters:LogFile=build.debug.log
if errorlevel 1 goto error

echo Building Release Configuration ...
%msbuild% %solution% /t:Rebuild /p:Configuration=Release /fileLogger /fileLoggerParameters:LogFile=build.release.log
if errorlevel 1 goto error

echo Preparing Deployment Package ...

"%ProgramFiles%\Microsoft\ILMerge\ILMerge.exe" /target:exe /internalize /ndebug /out:%dropDir%\ZenWplExporter.exe Bin\Debug\ZenWplExporter.exe Bin\Debug\CommandLineParser.dll Bin\Debug\ID3Tag.Net.dll Bin\Debug\Tags.dll
if errorlevel 1 goto error

xcopy notice.txt %dropDir%\*.* /Y
if errorlevel 1 goto error

pushd %dropDir%
%zip% a -tzip ZenWplExporter.zip ZenWplExporter.exe notice.txt
if errorlevel 1 goto error
popd

exit 0

:error
echo Build Failed!!!
pause
exit 1


PAUSE
